#include <iostream>
using namespace std;
#include <iomanip>

int calc(int row_index, int col_index)//Calculation given rows and columns of the element value .
{
	if( row_index == col_index || col_index == 1)
	{
		return 1;
	}
	else
	{
		return calc(row_index - 1, col_index - 1) + calc(row_index - 1, col_index);
	}

}


void outputOneRow(int row_index)//output pascal triangle one row element.
{
	for( int i = 1; i <= row_index; i++)
	{			
		cout << setw(4) << calc(row_index, i);
	}
	cout << endl;
}

void outputPascalTriangle(int depth)
{
    for( int i = 1; i <= depth; i++)
    {
        cout << setw( depth - i) << "";
 	    outputOneRow(i);	
    }
	cout << endl;	
}

int main()
{
    outputPascalTriangle(10);
    cout << endl;
    
    cout << "The third line the second column number is: " << calc(3,2) << endl;

    cout << "The element of ten row are: " << endl;
    outputOneRow(10);
    
	return 0;
} 
